package main

import (
	"bytes"
	"fmt"
	"io"
	"mime/multipart"
	"os"
)

func main() {

}

func PostFile() {
	body := &bytes.Buffer{}
	wirter := multipart.NewWriter(body)
	_ = wirter.WriteField("words", "123")
	_ = wirter.Close()

	//一个是输入表单的name,一个是上传的文件名称
	w, _ := wirter.CreateFormFile("uploadfile1", "uploadfile1")
	f, _ := os.Open("uploadfile1")
	defer f.Close()
	_, _ = io.Copy(w, f)
	wirter.Close()

	fmt.Println(body.String())
}
